package com.xxgc.ssm.controller;

import com.xxgc.ssm.po.DeliveryClerk;
import com.xxgc.ssm.po.info.Info;
import com.xxgc.ssm.po.req.ExamineReg;
import com.xxgc.ssm.util.ErrorResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpSession;
import javax.validation.Valid;

@Controller
@RequestMapping("/examine")
@Api(tags = "审核模块",description = "用户用户变成商家或骑手")
@ResponseBody
public class ExamineController {

    //申请成为商家
    @RequestMapping(value = "/becomeAMerchant",method = RequestMethod.POST)
    @ApiOperation(value = "申请成为商家",notes = "调用这个接口必须先登录")
    public Info becomeAMerchant(@RequestBody @ApiParam("商家对象") @Valid ExamineReg.BecomeAMerchantBean business,
                                BindingResult result,
                                @ApiIgnore HttpSession session,
                                @ApiIgnore Info info){
        info = ErrorResult.controller(result,info);
        return info != null ?  info : null;
    }

    //申请成为骑手
    @RequestMapping(value = "/becomeARider",method = RequestMethod.POST)
    @ApiOperation(value = "申请成为配送员",notes = "调用这个接口必须先登录")
    public Info becomeARider(DeliveryClerk dc, HttpSession session,@ApiIgnore Info info){
        return info;
    }
}
